import http from '/@lib/utils/http/request'

import { MenuForm, MenuQuery, MenuVO } from './types.ts'

export const ApiSysMenu: any = {}

// 查询菜单列表
ApiSysMenu.list = async (query?: MenuQuery): Promise<MenuVO[]> => {
  const params = {
    ...query
  }
  return http.get('/sysMenu/list', params)
}

// 查询菜单列表
// ApiMenu.listTreeSelect = async (): Promise<MenuVO[]> => {
//   return http.get<MenuVO[]>("/system/menu/listTreeSelect");
// };

// 新增菜单
ApiSysMenu.save = (data: MenuForm) => {
  return http.post('/sysMenu/save', data)
}

// 修改菜单
ApiSysMenu.update = (data: MenuForm) => {
  return http.post('/sysMenu/update', data)
}

// 删除菜单
ApiSysMenu.remove = (menuId: string | number) => {
  return http.post('/sysMenu/remove/' + menuId)
}

//   treeSelect: async () => {
//   return http.get<MenuTreeOption[]>("/system/menu/treeselect");
// }

// 根据角色ID查询菜单下拉树结构
// ApiMenu.roleMenuTreeSelect = (roleId: string | number): Promise<RoleMenuTree> => {
//   return http.get("/system/menu/roleMenuTreeselect/" + roleId);
// };
